﻿using ADManage.api.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Claims;
using System.Threading.Tasks;
using System.Web;
using System.Web.Http;
using XF.Meeting.Api.Models;
using XF.Meeting.Entity.CommonEntity;
using XF.Meeting.Entity.dbEntity;
using XF.Meeting.Entity.DTO;
using XF.Meeting.Entity.Query;
using XF.Meeting.Entity.View;

namespace XF.Meeting.Api.Controllers
{
    public class SettingController : BaseController
    {
        /// <summary>
        /// 获取系统名称
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [AllowAnonymous]
        public async Task<IHttpActionResult> GetSystemName()
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var list = await service.GetSystemName();

            if (list != null)
            {
                var res = new ResultBase<List<SystemNameInfo>>()
                {
                    data = list,
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<List<SystemNameInfo>>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "获取系统名称",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }
        /// <summary>
        /// 获取系统预约显示时段
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> GetSubscribe()
        {
          
              var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var list = await service.GetSubscribe();

            if (list != null)
            {
                var res = new ResultBase<SubscribeInfo>()
                {
                    data = list,
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<SubscribeInfo>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "获取系统预约显示时段失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }
        /// <summary>
        /// 获取系统设置
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> GetSettingSystem()
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var list = await service.GetSettingSystem();

            if (list != null && list.Count>0)
            {
                var res = new ResultBase<List<SettingSystem>>()
                {
                    data = list,
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<List<SettingSystem>>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "获取系统设置失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }
        /// <summary>
        /// 获取第三方设置
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> GetSettingThirdParty()
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var list = await service.GetSettingThirdParty();

            if (list != null && list.Count > 0)
            {
                var res = new ResultBase<List<SettingThirdParty>>()
                {
                    data = list,
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<List<SettingThirdParty>>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "获取第三方设置失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }
        /// <summary>
        /// 获取使用许可
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> GetSettingUseLicense()
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var list = await service.GetSettingUseLicense();

            if (list != null && list.Count > 0)
            {
                var res = new ResultBase<List<SettingUseLicense>>()
                {
                    data = list,
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<List<SettingUseLicense>>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "获取使用许可设置失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }
        /// <summary>
        /// 修改系统设置
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> UpdateSettingSystem([FromBody]ObjBase<SettingSystem> entity)
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var bResult = await service.UpdateSettingSystem(entity.obj);

            if (bResult)
            {
                var res = new ResultBase<String>()
                {
                    data = "修改系统设置成功",
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<String>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "修改系统设置失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }
        /// <summary>
        /// 修改第三方设置
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> UpdateSettingThirdParty([FromBody]ObjBase<SettingThirdParty> entity)
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var bResult = await service.UpdateSettingThirdParty(entity.obj);

            if (bResult)
            {
                var res = new ResultBase<String>()
                {
                    data = "修改第三方设置成功",
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<String>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "修改第三方设置失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }
        /// <summary>
        /// 修改使用许可
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> UpdateSettingUseLicense([FromBody]ObjBase<SettingUseLicense> entity)
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var bResult = await service.UpdateSettingUseLicense(entity.obj);

            if (bResult)
            {
                var res = new ResultBase<String>()
                {
                    data = "修改使用许可成功",
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<String>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "修改使用许可失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }
        /// <summary>
        /// 添加区域
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> AddRegional([FromBody]ObjBase<RegionalInfo> entity)
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var (bResult, strError) = await service.AddRegional(entity.obj);

            if (bResult)
            {
                var res = new ResultBase<String>()
                {
                    data = "添加区域成功",
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<String>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = strError,
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }
        /// <summary>
        /// 修改区域
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> UpdateRegional([FromBody]ObjBase<RegionalInfo> entity)
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var (bResult, strError) = await service.UpdateRegional(entity.obj);

            if (bResult)
            {
                var res = new ResultBase<String>()
                {
                    data = "修改区域成功",
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<String>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = strError,
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }
        /// <summary>
        /// 删除区域
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> DeleteRegional([FromBody]ObjBase<RegionalInfo> entity)
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var (bResult, strError) = await service.DeleteRegional(entity.obj);

            if (bResult)
            {
                var res = new ResultBase<String>()
                {
                    data = "删除区域成功",
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<String>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = strError,
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }
        /// <summary>
        /// 获取区域
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> GetRegional([FromBody]ObjBase<RegionalQuery> query)
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var list = await service.GetRegional(query.obj);

            if (list != null)
            {
                var res = new ResultBase<PageList<RegionalInfo>>()
                {
                    data = list,
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<PageList<RegionalInfo>>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "获取区域失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }

        /// <summary>
        /// 获取区域    Mobile
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        [AllowAnonymous]
        public async Task<IHttpActionResult> GetRegionalForMobile([FromBody]ObjBase<RegionalQuery> query)
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var list = await service.GetRegionalForMobile(query.obj);

            if (list != null)
            {
                var res = new ResultBase<PageListMobile<RegionalInfo>>()
                {
                    data = list,
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<PageListMobile<RegionalInfo>>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "获取区域失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }

        /// <summary>
        /// 获取区域根节点信息
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> GetRegionalOne()
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var list = await service.GetRegionalOne();

            if (list != null)
            {
                var res = new ResultBase<List<RegionalInfo>>()
                {
                    data = list,
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<List<RegionalInfo>>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "获取区域根节点失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }

        /// <summary>
        /// 获取区域根节点信息
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> GetRegionalOneForAdmin([FromBody]ObjBase<RegionalInfo> query)
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var list = await service.GetRegionalOneForAdmin(query.obj);

            if (list != null)
            {
                var res = new ResultBase<List<RegionalInfo>>()
                {
                    data = list,
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<List<RegionalInfo>>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "获取区域根节点失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }

        /// <summary>
        ///根据父ID获取区域根节点信息
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> GetRegionalByPID([FromBody]ObjBase<RegionalQuery> query)
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var list = await service.GetRegionalByPID(query.obj);

            if (list != null)
            {
                var res = new ResultBase<List<RegionalInfo>>()
                {
                    data = list,
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<List<RegionalInfo>>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "获取区域信息失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }


        /// <summary>
        /// 获取区域的会议室（Pad绑定）
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        [AllowAnonymous]
        public async Task<IHttpActionResult> GetRegionalForPad()
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var list = await service.GetRegionalForPad();

            if (list != null)
            {
                var res = new ResultBase<List<Root>>()
                {
                    data = list,
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<List<Root>>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "获取区域及会议室失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }

        /// <summary>
        /// ad同步
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> ADUserSync()
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var bResult = await service.ADUserSync();

            if (bResult)
            {
                var res = new ResultBase<String>()
                {
                    data = "AD账号同步成功",
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<String>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "AD账号同步失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }

        /// <summary>
        /// 行政组织树(Tree)
        /// </summary>
        /// <param name=""></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> GetOrganizationTree()
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var list = await service.GetOrganizationTree();

            if (list != null)
            {
                var res = new ResultBase<List<OrganizationTree>>()
                {
                    data = list,
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<List<OrganizationTree>>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "获取行政组织树失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }

        
        /// <summary>
        /// 获取区域下的关联组织
        /// </summary>
        /// <param name="query"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> GetRegional_Organization([FromBody]ObjBase<Regional_Organization> query)
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var list = await service.GetRegional_Organization(query.obj);

            if (list != null)
            {
                var res = new ResultBase<List<Regional_OrganizationEntity>>()
                {
                    data = list,
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<List<Regional_OrganizationEntity>>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "获取区域下的关联组织失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }

        

        /// <summary>
        /// 获取行政组织根节点信息
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> OrganizationOne()
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var list = await service.GetOrganizationOne();

            if (list != null)
            {
                var res = new ResultBase<List<OrganizationInfo>>()
                {
                    data = list,
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<List<OrganizationInfo>>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "获取区域根节点失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }

        /// <summary>
        ///根据父ID获取行政组织信息
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<IHttpActionResult> GetOrganizationByPID([FromBody]ObjBase<OrganizationQuery> query)
        {
            var dic = User.Identity as ClaimsIdentity;
            var user = GetUser(dic);
            var service = abs.CreateSettingSystemInterface(user.UserName, IPHelper.GetIPAddress);
            var list = await service.GetOrganizationByPID(query.obj);

            if (list != null)
            {
                var res = new ResultBase<List<OrganizationInfo>>()
                {
                    data = list,
                    success = true,
                    errormsg = ""
                };
                var data = new ObjBase<ResultBase<List<OrganizationInfo>>>()
                {
                    obj = res,
                    secret = "123"
                };
                return Content(HttpStatusCode.OK, data);
            }
            else
            {
                var result = new ErrorBase()
                {
                    data = "",
                    errmsg = "获取行政组织信息失败",
                    success = false
                };
                return Content(HttpStatusCode.OK, new ObjBase<ErrorBase>()
                {
                    obj = result,
                    secret = "123"
                }
                );
            }
        }
    }
}